import { MusicModel } from '../models/music';
import { NotFound } from "lin-mizar/lin";
import {MovieModel} from "../models/movie";

class Music {
  static async deleteMusic (id) {
    const music = await MusicModel.destroy({
      where: { id }
    });
    return music;
  }
  static async editMusic (id, params) {
    const music = await MusicModel.findByPk(id);
    if (!music) {
      throw new NotFound();
    }
    const emu = await music.update({ ...params });
    return emu;
  }
  static async getMusicList () {
    const music = await MusicModel.findAll();
    return music;
  }
  static async addMusic (cv) {
    const music = await MusicModel.create(cv);
    return music;
  }
}
export { Music as MusicDao };